<style type="text/css">
    #page{height:auto;padding:2px 6px 30px 6px;text-align: center;}
    #page span{  margin-left: 5px; margin-right: 5px;color: #999; padding: 2px 6px;border: 1px solid #D5D5D5;border-radius: 3px;}
    #page span.nowpage{  color: #fff; background-color: #3F56E0; border-radius: 3px;border: 1px solid #3F56E0;padding: 2px 7px;}
    #page span.list{border:0px;}
    #page a{border: 1px solid #D5D5D5;padding: 2px 7px}
    #page a{margin-left:5px;margin-right:5px;border-radius: 3px;}
    #page a:link,#page a:visited{color:#585858;text-decoration: none;}
    #page a:hover{background-color:#3F56E0;color:#fff;text-decoration:none;border: 1px solid #3F56E0;}
</style>
<script type="text/javascript">
    $(document).ready(function(){
        $('#page a').click(function(){
            $(this).blur();
        });
    });
</script>
<?php
$params = '*';
$rel = '';
if( $style == 'demand' ){
    $params = 'p*';
    foreach( $_params as $key=>$val){
        if( $key != 'p' ){
            $params.=$key.$val;
        }
    }
    $rel = ' rel= "nofollow" ';
}
$prev = $page_vars['no']>1?'<a href="'.str_replace('*',str_replace('*',$page_vars['no']-1,$params),$page_url).'"'.$rel.'>上一页</a>':'<span>上一页</span>';

$first = '';
$left = '';
$now = '';
$right = '';
$firstpage = '';
$endpage   = '';

if($page_vars['isfe'])
{
    $firstpage = $page_vars['no'] == 1?'<span>首页</span>':'<a href="'.str_replace('*',str_replace('*',1,$params),$page_url).'"'.$rel.'>首页</a>';
    $endpage = $page_vars['no'] == $page_vars['total']?'<span>尾页</span>':'<a href="'.str_replace('*',str_replace('*',$page_vars['total'],$params),$page_url).'"'.$rel.'>尾页</a>';
}

if($page_vars['no']<4){
    for($i=1;$i<4;$i++){
        if($i<=$page_vars['total']){
            $first.= $page_vars['no']!=$i?'<a href="'.str_replace('*',str_replace('*',$i,$params),$page_url).'"'.$rel.'>'.$i.'</a>':'<span class="nowpage">'.$i.'</span>';
        }
    }
    if($page_vars['total']>4){
        $right = '<span class="list">---</span>';
    }
}else{
    $first = '<a href="'.str_replace('*',str_replace('*',1,$params),$page_url).'"'.$rel.'>1</a><span class="list">---</span>';
    $left = '<a href="'.str_replace('*',str_replace('*',$page_vars['no']-1,$params),$page_url).'"'.$rel.'>'.($page_vars['no']-1).'</a>';
    $now = '<span class="nowpage">'.$page_vars['no'].'</span>';
    $right = $page_vars['no']+1<$page_vars['total']?'<a href="'.str_replace('*',str_replace('*',$page_vars['no']+1,$params),$page_url).'"'.$rel.'>'.($page_vars['no']+1).'</a><span class="list">---</span>':'';
}

$last  = ($page_vars['no']<$page_vars['total'] && $page_vars['total']>=4)?'<a href="'.str_replace('*',str_replace('*',$page_vars['total'],$params),$page_url).'"'.$rel.'>'.$page_vars['total'].'</a>':'';
$next = $page_vars['no']<$page_vars['total']?'<a href="'.str_replace('*',str_replace('*',$page_vars['no']+1,$params),$page_url).'"'.$rel.'>下一页</a>':'<span>下一页</span>';

?>

<div id="page" class="clearfix"><?php echo $firstpage.$prev.$first.$left.$now.$right.$last.$next.$endpage;?></div>